package com.soft.admin.login.serviceimpl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import com.soft.admin.login.service.ILoginService;
import com.soft.dao.GenericDao;
import com.soft.mapping.User;

public class LoginServiceImpl extends GenericDao<User> implements ILoginService {

	@Override
	public User getUser(String uname, String upwd) {
		Criteria cr = this.getSession().createCriteria(super.getPojoClass());
		cr.add(Restrictions.eq("uname", uname));
		cr.add(Restrictions.eq("upwd", upwd));
		@SuppressWarnings("unchecked")
		List<User> list = cr.list();
		if (list != null && list.size() > 0) {
			return list.get(0);
		}
		return null;
	}

}
